from django.db import models
from utils.models import BaseModel


class Product(BaseModel):
    product_id = models.CharField('货品编码', max_length=200, unique=True, help_text='货品编码')
    category = models.CharField('类别', max_length=40, null=True, blank=True, default='', help_text='类别')
    brand = models.CharField('品牌', max_length=100, null=True, blank=True, default='', help_text='品牌')
    name = models.CharField('品名', max_length=100, null=True, blank=True, default='', help_text='品名')
    price = models.DecimalField('产品单价', max_digits=10, decimal_places=2, default=0, help_text='产品单价')
    sample_png = models.CharField("样图", max_length=500, null=True, blank=True, default='', help_text='样图')
    desc = models.CharField('备注', max_length=1000, null=True, blank=True, default='', help_text='备注')

    class Meta:
        db_table = 'tb_product'
        verbose_name = '产品信息'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.product_id
